home *** CD-ROM | disk | FTP | other *** search
/ System Booster / System Booster.iso / Archives / GNU / GNUPLOTsrc.lha / term / v384.trm < prev    next >
Encoding:
Text File  |  1996-01-22  |  4.4 KB  |  190 lines

  1. /*
  2.  * $Id: v384.trm,v 1.6 1995/12/20 21:48:19 drd Exp $
  3.  *
  4.  */
  5.  
  6. /* GNUPLOT - v384.trm */
  7. /*
  8.  * Copyright (C) 1990 - 1993   
  9.  *
  10.  * Permission to use, copy, and distribute this software and its
  11.  * documentation for any purpose with or without fee is hereby granted, 
  12.  * provided that the above copyright notice appear in all copies and 
  13.  * that both that copyright notice and this permission notice appear 
  14.  * in supporting documentation.
  15.  *
  16.  * Permission to modify the software is granted, but not the right to
  17.  * distribute the modified code.  Modifications are to be distributed 
  18.  * as patches to released version.
  19.  *  
  20.  * This software  is provided "as is" without express or implied warranty.
  21.  * 
  22.  * This file is included by ../term.c.
  23.  *
  24.  * This terminal driver supports:
  25.  *  Vectrix 384 - works with tandy color printer as well
  26.  *
  27.  * AUTHORS
  28.  *   roland@moncskermit.OZ (Roland Yap) 
  29.  * 
  30.  * send your comments or suggestions to (info-gnuplot@dartmouth.edu).
  31.  * 
  32.  */
  33.  
  34. /*
  35.  *    Vectrix 384 driver - works with tandy color printer as well
  36.  *  in reverse printing 8 color mode.
  37.  *  This doesn't work on Vectrix 128 because it redefines the
  38.  *  color table. It can be hacked to work on the 128 by changing
  39.  *  the colours but then it will probably not print best. The color
  40.  *  table is purposely designed so that it will print well
  41.  *
  42.  */
  43.  
  44. /*
  45.  * adapted to the new terminal layout by Stefan Bodewig (Dec. 1995)
  46.  */
  47.  
  48. #ifndef GOT_DRIVER_H
  49. #include "driver.h"
  50. #endif
  51.  
  52. #ifdef TERM_REGISTER
  53. register_term(vx384)
  54. #endif
  55.  
  56. #ifdef TERM_PROTO
  57. TERM_PUBLIC void V384_init __P((void));
  58. TERM_PUBLIC void V384_graphics __P((void));
  59. TERM_PUBLIC void V384_text __P((void));
  60. TERM_PUBLIC void V384_linetype __P((int linetype));
  61. TERM_PUBLIC void V384_move __P((unsigned int x, unsigned int y));
  62. TERM_PUBLIC void V384_vector __P((unsigned int x, unsigned int y));
  63. TERM_PUBLIC void V384_put_text __P((unsigned int x, unsigned int y, char str[]));
  64. TERM_PUBLIC void V384_reset __P((void));
  65.  
  66. #define V384_XMAX 630
  67. #define V384_YMAX 480
  68.  
  69. #define V384_XLAST (V384_XMAX - 1)
  70. #define V384_YLAST (V384_YMAX - 1)
  71.  
  72. #define V384_VCHAR    12
  73. #define V384_HCHAR    7
  74. #define V384_VTIC    8
  75. #define V384_HTIC    7
  76. #endif /* TERM_PROTO */
  77.  
  78. #ifndef TERM_PROTO_ONLY
  79. #ifdef TERM_BODY
  80.  
  81. TERM_PUBLIC void V384_init()
  82. {
  83.     fprintf(outfile,"%c%c  G0   \n",27,18);
  84.     fprintf(outfile,"Q 0 8\n");
  85.     fprintf(outfile,"0 0 0\n");
  86.     fprintf(outfile,"255 0 0\n");
  87.     fprintf(outfile,"0 255 0\n");
  88.     fprintf(outfile,"0 0 255\n");
  89.     fprintf(outfile,"0 255 255\n");
  90.     fprintf(outfile,"255 0 255\n");
  91.     fprintf(outfile,"255 255 0\n");
  92.     fprintf(outfile,"255 255 255\n");
  93. }
  94.  
  95.  
  96. TERM_PUBLIC void V384_graphics()
  97. {
  98.     fprintf(outfile,"%c%c E0 RE N 65535\n",27,18);
  99. }
  100.  
  101.  
  102. TERM_PUBLIC void V384_text()
  103. {
  104.     fprintf(outfile,"%c%c\n",27,17);
  105. }
  106.  
  107.  
  108. TERM_PUBLIC void V384_linetype(linetype)
  109. int linetype;
  110. {
  111. static int color[]= {
  112.         1 /* red */,
  113.         2 /* green */,
  114.         3 /* blue */,
  115.         4 /* cyan */,
  116.         5 /* magenta */,
  117.         6 /* yellow */, /* not a good color so not in use at the moment */
  118.         7 /* white */
  119.     };
  120.         
  121.     if (linetype < 0)
  122.         linetype=6;
  123.     else
  124.         linetype %= 5;
  125.     fprintf(outfile,"C %d\n",color[linetype]);
  126. }
  127.  
  128.  
  129. TERM_PUBLIC void V384_move(x,y)
  130. unsigned int x,y;
  131. {
  132.     fprintf(outfile,"M %d %d\n",x+20,y);
  133. }
  134.  
  135.  
  136. TERM_PUBLIC void V384_vector(x,y)
  137. unsigned int x,y;
  138. {
  139.     fprintf(outfile,"L %d %d\n",x+20,y);
  140. }
  141.  
  142.  
  143. TERM_PUBLIC void V384_put_text (x, y, str)
  144. unsigned int x, y;
  145. char str[];
  146. {
  147.     V384_move (x, y + V384_VCHAR/2);
  148.     fprintf (outfile, "$%s\n", str);
  149. }
  150.  
  151.  
  152. TERM_PUBLIC void V384_reset()
  153. {
  154. }
  155.  
  156. #endif /* TERM_BODY */
  157.  
  158. #ifdef TERM_TABLE
  159.  
  160. TERM_TABLE_START(vx384_driver)
  161.     "vx384", "Vectrix 384 and Tandy color printer",
  162.        V384_XMAX, V384_YMAX, V384_VCHAR, V384_HCHAR, 
  163.        V384_VTIC, V384_HTIC, options_null, V384_init, V384_reset, 
  164.        V384_text, null_scale, V384_graphics, V384_move, V384_vector, 
  165.        V384_linetype, V384_put_text, null_text_angle, 
  166.        null_justify_text, do_point, do_arrow, set_font_null
  167. TERM_TABLE_END(vx384_driver)
  168.  
  169. #undef LAST_TERM
  170. #define LAST_TERM vx384_driver
  171.  
  172. #endif /* TERM_TABLE */
  173. #endif /* TERM_PROTO_ONLY */
  174.  
  175. /*
  176.  * NAME: vx384
  177.  *
  178.  * OPTIONS: none
  179.  *
  180.  * SUPPORTS: Vectrix 384 and Tandy color printer
  181.  *
  182.  * Further Info: from top of file
  183.  *    Vectrix 384 driver - works with tandy color printer as well
  184.  *  in reverse printing 8 color mode.
  185.  *  This doesn't work on Vectrix 128 because it redefines the
  186.  *  color table. It can be hacked to work on the 128 by changing
  187.  *  the colours but then it will probably not print best. The color
  188.  *  table is purposely designed so that it will print well
  189.  *
  190.  */